<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>


<table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
 <!--     <tr align=center>
        <td class="title" width="100%">Gi&#7899;i thi&#7879;u: <a href="./?act=dv_m&page=<? echo $_REQUEST['page']?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nh&#7853;p M&#7899;i</font></a>&nbsp;|&nbsp
	</td>
      </tr>-->
    </table>
<?
	switch ($_GET['action'])
	{
		case 'del' :
			$id = $_GET['id'];
			$news=GetaboutInfo($id);
			if ($news)
			{
				$sql = "delete from about where news_id='".$id."'";
				$result = mysql_query($sql,$con);
				if ($result) 
				{
					if (@file_exists($news['news_image'])) @unlink($news['news_image']);
					echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
				}
					else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
			}
			break;
	}
?>

<?
	if (isset($_POST['ButDel'])) {
		$cnt=0;
		foreach ($_POST['chk'] as $id)
		{
			$news=GetaboutInfo($id);
			if ($news)
			{
				@$result = mysql_query("delete from about where news_id='".$id."'",$con);
				if ($result) {
					$cnt++;
					if (@file_exists($news['news_image'])) @unlink($news['news_image']);
				}
			}
		}
		echo "<p align=center class='err'>&#272;ã xóa ".$cnt."</p>";
	}
?>
<?
	//$MAXPAGE=10;
	$page = $_GET["page"];
	$p=0;
	if ($page!='') $p=$page;
	$where="1=1";
	if ($_REQUEST['cat']!='') $where="categories_id=".$_REQUEST['cat'];
?>
<form method="POST" name="frmList" action="index.php">
<input type="hidden" name="act" value="dv">
<input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">

<table cellspacing="0" cellpadding="0" width="100%">
<? if ($_REQUEST['code']==1) echo '<tr><td colspan=2 align="center" class="err">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
<tr>
<td class="smallfont">
<?
	$total=CountRecord("about"); 
	if ($total>0) ListPaging($total,count_page($total,$MAXPAGE),$p,"./?act=".$_REQUEST['act']."&cat=".$_REQUEST['cat']."&page=","m&#7909;c");
?>
</td>
<td height="30" align="right" class="smallfont">
	 

	</td>
</tr>
</table>

<table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
  <tr>
    <td width="29" align=center nowrap class="title"><input type="checkbox" name="chkall" onClick="chkallClick(this);"></td>
    <td colspan="2" nowrap class="title">&nbsp;</td>
    <td width="31" align="center" nowrap class="title"><b>Mã</b></a></td>
    <td width="192" align="center" nowrap class="title"><strong>Danh mục tiếng Việt  </strong></td>
  <!--  <td width="179" align="center" nowrap class="title"><strong>Danh mục tiếng <b>Anh</b> </strong></td>
   --> <td width="76" align="center" nowrap class="title"><b>Không hi&#7879;n</b></a></td>
    <td width="73" align="center" nowrap class="title"><b>Ngày</b></a></td>
    <td width="53" align="center" nowrap class="title"><b>S&#7855;p x&#7871;p</b></a></td>
  </tr>
  
  <?
  			$sortby="order by date_added";
  			if ($_REQUEST['sortby']!='') $sortby="order by ".(int)$_REQUEST['sortby'];
  			$direction=($_REQUEST['direction']==''||$_REQUEST['direction']=='0'?"desc":"");
           	$sql="select * from about where $where $sortby $direction limit ".($p*$MAXPAGE).",".$MAXPAGE;
        	$result=mysql_query($sql,$con);
        	$i=0;
           	while(($row=mysql_fetch_array($result)))
			{
			$i++;
			if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
			
  ?>
  
  <tr>
    <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
    <input type="checkbox" name="chk[]" value="<? echo $row['news_id']; ?>"></td>
    <td width="36" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
    <a href="./?act=dv_m&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['news_id']; ?>&page=<? echo $_REQUEST['page'];?>">S&#7917;a</a></td>
    <td width="22" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
   <!-- <a onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=dv&action=del&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['news_id']; ?>">Xóa</a>--></td>
    <td bgcolor="<? echo $color; ?>" align="left"  class="smallfont"><? echo $row['news_id']; ?>&nbsp;</td>
    <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['news_subject']; ?>&nbsp;</td>
    <!-- <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['news_source']; ?>&nbsp;</td>   
    --><td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['status']; ?>&nbsp;</td>
    <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo date('d/m/Y',strtotime($row['date_added'])); ?>&nbsp;</td>
    <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['news_ordered']; ?>&nbsp;</td>
  </tr>
  <?
              	}
  ?>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
<!--  <tr>
		<td>
<input type="submit" value="Xóa Ch&#7885;n" name="ButDel" onClick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button"></td>
		<td align="right">
		
	<input type="submit" value="Ch&#7885;n là b&#7843;n tin m&#7899;i" name="ButHot" class="button">&nbsp; 
</td>
	</tr>-->
</table>
<input type="hidden" name="act" value="dv">
</form>
<script language="JavaScript">
function chkallClick(o) {
  	var form = document.frmList;
	for (var i = 0; i < form.elements.length; i++) {
		if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
			form.elements[i].checked = document.frmList.chkall.checked;
		}
	}
}
</script>